#ifndef _CPRESSWIDGET_H_
#define _CPRESSWIDGET_H_

#include <buola/utility/uevent.h>
#include <buola/gui/cwindow.h>

namespace buola { namespace gui {

///\addtogroup widgetclass
///@{

////////////////////////////////////////////////////////////////////////////

/// press widget

/// this class represents a widget that can be pressed
///
///
////////////////////////////////////////////////////////////////////////////

class CPushWidget : public C
{
protected:
    CPushWidget()
        :   mPWPressed(false),
            mPWInside(false)
    {}

    virtual ~CPushWidget() {}

    void PWPressed()
    {
        mPWPressed=true;
    }

    void PWReleased()
    {
        if(!mPWPressed)
            return;

        mPWPressed=false;

        if(mInside)
            ePressed();
    }

    void PWInside()
    {
        mPWInside=true;
    }

    void PWOutside()
    {
        mPWInside=false;
    }

    bool PWIsPressed()                  {   return mPressed;            }
    bool PWIsInside()                   {   return mInside;             }

public:
    UEvent<void()> ePressed;

private:
    bool mPWPressed;
    bool mPWInside;
};

/*namespace gui*/ } /*namespace buola*/ }

#endif
